function  closestNode1 = getClosestNode(sender, receiver, neighborsS, disp_loc)      
      u = length(neighborsS);        
      closestNode = 0;
      closestNode1 = 0;
      %   The distance between all the source neighborhoods' nodes and the destination nodes.
            disp('The distance between all the sender neighborhood nodes and the destination.');
            [DBSND]= distanceBetweenSourceAndNeighbors(receiver,neighborsS,disp_loc);
            k = length(DBSND);
            L1 = DBSND(1);
            closestNode = neighborsS(1);            
            for i = 2:k
                L2 = DBSND(i);
                if L2 == 0
                    L2 = L1;
                end
                if L2 < L1
                    if neighborsS(i) ~= receiver && neighborsS(i) ~= sender
                        closestNode = neighborsS(i);                        
                        closestNode1 = closestNode;
                    end
                    L1 = L2;
                end
            end
           
end
          